class Layer {
  float x, y, zFactor;
  PImage img;
  Camera cam;
  
  Layer(float x, float y, float z, PImage img, Camera cam) {
    this.x = x;
    this.y = y;
    this.zFactor = 1 / z;
    this.img = img;
    this.cam = cam;
  }
  
  void draw() {
    pushMatrix();
    translate(this.x + (this.cam.x - this.x) * this.zFactor, y);
    image(img, 0, 0);
    popMatrix();
  }
}
